<%@ LANGUAGE="VBScript" %> <% const crash_time=40000 time_start=Now() dim s_wait dim wait_time dim start_time dim end_time dim s_start dim s_end dim s_old Dim st_pedcalc dim ed_pedcalc ' actions(0,i) action ' actions(1,i) description ' actions(2,i) group ' ' Dim actions(2,20) ' 'action_results(0,i)integer number of times the action took place( imp in sinking and pass) 'action_results(1,i) datevalue action time ' Dim action_results(2,20) ' ' ' groups ' action_groups(0,i) name ' action_groups(1,i) display result ' Dim action_groups(1,20) 'create array for assigned icons Dim color(6) If Request("text_only")<>"" Then text_only=Request("text_only") else text_only=0 End If If text_only="1" then color(0)="O" color(1)="P" color(2)="C" color(3)="U" color(4)="N" color(5)="W" color(6)="C'" Else color(0)=""" Then run_type=CStr(Request("run_type")) Else run_type="ALLBEAM" End If ' ' Get first and last run number ' If Request("run_min")<>"" Then run_min=CInt(Request("run_min")) Else run_min=6175 End If If Request("run_max")<>"" Then run_max=CInt(Request("run_max")) Else run_max=6176 End If If Request("summary")<>"" Then sum=cstr(Request("summary")) else sum="0" End If if sum="1" then summary=true end if ' ' Open Database ' Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd ' ' This SQL statement gives an ordered list of actions related to run of type run_type ' SQLStmt = " select ta.action,la.action_group,la.description from phoffline.track_actions ta,phoffline.log_actions la " SQLStmt = SQLStmt & " where la.action=ta.action and la.action_type=2 and ta.run_type='" & run_type & "' " SQLStmt = SQLStmt & " order by la.action_order " ' response.write(SQLStmt) Set RS = Connection.Execute(SQLStmt) nactions=0 ngroups=0 old_group="" Do While Not RS.EOF group=CStr(RS("action_group")) actions(0,nactions)=CStr(RS("action")) actions(1,nactions)=CStr(RS("description")) actions(2,nactions)=group nactions=nactions+1 If group<>old_group Then action_groups(0,ngroups)=group ngroups=ngroups+1 old_group=group End If RS.MoveNext Loop Set RS=nothing ' ' For i=0 to ngroups-1 ' Response.write(i & " " & action_groups(0,i) & " " & action_groups(1,i) & "
") ' Next ' ' Get last run and sequence ' SQLStmt = " select max(run) last_run,max(sequence) last_sequence ,to_char(sysdate,'MM/DD/YYYY HH24:MI:SS') timedate from phoffline.runseqs " SQLStmt = SQLStmt & " where run=(select max(run) from phoffline.runseqs) " Set RS = Connection.Execute(SQLStmt) last_run=CStr(RS("last_run")) last_sequence=CStr(RS("last_sequence")) timedate=formatdatetime(RS("timedate"),0) ' i_new_sequence=actiongroup("NEW_SEQUENCE") i_pedcalc=actiongroup("PEDCALC") i_sinking=actiongroup("SINKING") i_pass0=actiongroup("PASS0") i_dv=actiongroup("DV") ' ' And this statement lists the run number and the number of times a given ' action was performed. 0 means that the action was never done. ' SQLStmt = " select max(ta1.run) run,max(ta1.sequence) sequence,count(rl.action) naction,to_char(max(rl.log_date),'MM/DD/YYYY HH24:MI:SS') ddate from " SQLStmt = SQLStmt & " (select rn.run,rn.sequence,ruu.run_type,ta.action,le.log_date from phoffline.log_entries le,phoffline.log_actions la, " SQLStmt = SQLStmt & " phoffline.runseq_numbers rn, phoffline.runs ruu, phoffline.runseqs ru,phoffline.track_actions ta " SQLStmt = SQLStmt & " where ta.action=le.action and la.action=ta.action and rn.logid=le.logid and rn.run=ru.run and rn.run=ruu.run and ru.sequence=rn.sequence " SQLStmt = SQLStmt & " and ruu.run_type='" & run_type & "' " SQLStmt = SQLStmt & " and ta.run_type=ruu.run_type and la.action_type=2 " SQLStmt = SQLStmt & " and ruu.run between " & CStr(run_min) & " and " & CStr(run_max) & ") rl, " SQLStmt = SQLStmt & " (select r.run,r.sequence,l.action,l.action_order,rr.run_type " SQLStmt = SQLStmt & " from phoffline.track_actions t,phoffline.runseqs r,phoffline.runs rr,phoffline.log_actions l " SQLStmt = SQLStmt & " where rr.run_type='" & run_type & "' " SQLStmt = SQLStmt & " and l.action=t.action and t.run_type=rr.run_type and r.run=rr.run and l.action_type=2 " SQLStmt = SQLStmt & " and r.run between " & CStr(run_min) & " and " & CStr(run_max) & ") ta1 " SQLStmt = SQLStmt & " where ta1.action=rl.action(+) and ta1.run=rl.run(+) and ta1.sequence=rl.sequence(+)" SQLStmt = SQLStmt & " group by ta1.run,ta1.sequence,ta1.action " SQLStmt = SQLStmt & " order by ta1.run desc,ta1.sequence,max(ta1.action_order) " 'response.write(SQLStmt) Set RS = Connection.Execute(SQLStmt) %> Sequence Production Status

Sequence Production Status: Runs of type <%=run_type%> from <%=run_min%> to <%=run_max%>

Go to request Page

The links below can be used to see if any jobs fall into these categories

Sinking jobs Pass0 jobs DV jobs Sinking waiting Pass0 waiting Sinking crashed Pass0 crashed
 

Run Summary table follows : (4 buttons indicate status of DataTaking, Sinking, Pass0Running, Pass0Validating respectively)

<% ' ' We are now ready to loop through the runs. The number of runs is not known ' at this moment but we are sure that once the run is there it will have nactions-1 columns ' ' run_old=-10000 Do While Not RS.EOF run=CStr(RS("run")) sequence=CStr(RS("sequence")) ' ' check if we found a new run. If yes then close table and open new one ' it probably makes no sense to repeat legend every time, the new tables will ' be without headers ' If run<>run_old Then If run_old<>-10000 Then response.write("") response.write(" " & vbCrLf) Response.Write("Run "& run & "" & vbCrLf) Else ' response.write("" & vbCrLf) response.write("
" & vbCrLf) response.write("" & vbCrLf) Response.Write("" & vbCrLf) End If run_old=run ' new run becomes old run from now on Else ' ' same run ' If 0= (sequence) Mod 4 then Response.write("" & vbCrLf) else response.write("" & vbCrLf) end if End If ' ' write info for one sequence now. We know how many entries are for this sequence ' a priori so we can rely on For loop in advancing the records. ' ' For i=0 To nactions-1 action_results(0,i)=CInt(RS("naction")) if not isnull(RS("ddate"))then action_results(1,i)=formatdatetime(RS("ddate"),0) else action_results(1,i)="1/1/85" ' very old date such that the difference is huge end if RS.MoveNext Next ' ' Find location of this group ' igroup=i_new_sequence If igroup>-1 Then s_start=false s_end=false s_old=false For i=0 to nactions-1 If actions(2,i)="NEW_SEQUENCE" Then If actions(0,i)="START_SEQ" Then If CInt(action_results(0,i))>0 Then s_start=true End If Elseif actions(0,i)="END_SEQ" Then If CInt(action_results(0,i))>0 Then s_end=true End If Elseif actions(0,i)="NEW_RUN_SEQUENCE" Then If CInt(action_results(0,i))>0 Then s_old=true End If End If End If Next If (s_start and s_end) Or (s_old) Then action_groups(1,igroup)=color(0)'green ,ok Elseif (s_start and (Not s_end)) Then If (run=last_run And sequence=last_sequence) Then action_groups(1,igroup)=color(1)'yellow, still running Else action_groups(1,igroup)=color(2)'red, crash End If Else action_groups(1,igroup)=color(3) 'blue, unknown End If End If ' 'PEDCALC analysis ' igroup=i_pedcalc If igroup>-1 Then st_pedcalc=false ed_pedcalc=false For i=0 to nactions-1 If actions(2,i)="PEDCALC" then If actions(0,i)="START_PEDCALC" then If Cint(action_results(0,i))>0 then st_pedcalc=true end if Elseif actions(0,i)="END_PEDCALC" then If Cint(action_results(0,i))>0 then ed_pedcalc=true End if End if End if Next If (st_pedcalc and ed_pedcalc) then action_groups(1,igroup)=color(0)'ok Elseif (st_pedcalc and (not ed_pedcalc)) then action_groups(1,igroup)=color(2)' in progress else action_groups(1,igroup)=color(4)'not done End if end if ' 'Sink analysis ' igroup=i_sinking If igroup>-1 Then For i=0 to nactions-1 If actions(2,i)="SINKING" then If actions(0,i)="SINK_WAIT_SEQ" then s_wait=cint(action_results(0,i)) wait_time=action_results(1,i) Elseif actions(0,i)="SINK_START_SEQ" then s_start=cint(action_results(0,i)) start_time=action_results(1,i) Elseif actions(0,i)="SINK_END_SEQ" then s_end=cint(action_results(0,i)) end_time=action_results(1,i) end if end if Next if (s_start<=0 and s_end<=0) then if s_wait<=0 then action_groups(1,igroup)=color(4) ' not done elseif s_wait>0 then if datediff("s",wait_time,timedate)>crash_time then action_groups(1,igroup)=color(6) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if elseif(s_start>0 and s_end<=0) then if s_wait<=0 then if datediff("s",start_time,timedate)>crash_time then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if elseif s_wait>0 then if datediff("s",wait_time,start_time)>0 then if datediff("s",start_time,timedate)>crash_time then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if else if datediff("s",wait_time,timedate)>crash_time then action_groups(1,igroup)=color(6) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if end if elseif(s_start>0 and s_end>0) then if s_wait<=0 then if datediff("s",start_time,end_time)>0 then action_groups(1,igroup)=color(0)'ok else if datediff("s",start_time,timedate)>crash_time then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if end if elseif s_wait>0 then if datediff("s",wait_time,start_time)>0 then if datediff("s",start_time,end_time)>0 then action_groups(1,igroup)=color(0)'ok else if datediff("s",start_time,timedate)>crash_time then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if end if else if datediff("s",wait_time,timedate)>crash_time then action_groups(1,igroup)=color(6) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if end if Elseif (s_start<=0 and s_end>0) then if s_wait<=0 then action_groups(1,igroup)=color(0)'ok elseif s_wait>0 then if datediff("s",wait_time,end_time)>0 then action_groups(1,igroup)=color(0) 'ok else if datediff("s",wait_time,timedate)>crash_time then action_groups(1,igroup)=color(6) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if end if end if end if ' 'Pass analysis ' igroup=i_pass0 If igroup>-1 Then s_wait=false s_start=false s_end=false' For i=0 to nactions-1 If actions(2,i)="PASS0" then If actions(0,i)="P0_SUBMIT_SEQ" then s_wait=cint(action_results(0,i)) wait_time=action_results(1,i) Elseif actions(0,i)="P0_START_SEQ" then s_start=cint(action_results(0,i)) start_time=action_results(1,i) Elseif actions(0,i)="P0_END_SEQ" then s_end=cint(action_results(0,i)) end_time=action_results(1,i) end if end if Next if (s_start<=0 and s_end<=0) then if s_wait<=0 then action_groups(1,igroup)=color(4) ' not done elseif s_wait>0 then if datediff("s",wait_time,timedate)>crash_time then action_groups(1,igroup)=color(6) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if elseif(s_start>0 and s_end<=0) then if s_wait<=0 then if datediff("s",start_time,timedate)>crash_time then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if elseif s_wait>0 then if datediff("s",wait_time,start_time)>0 then if datediff("s",start_time,timedate)>crash_time then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if else if datediff("s",wait_time,timedate)>crash_time then action_groups(1,igroup)=color(6) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if end if elseif(s_start>0 and s_end>0) then if s_wait<=0 then if datediff("s",start_time,end_time)>0 then action_groups(1,igroup)=color(0)'ok else if datediff("s",start_time,timedate)>crash_time then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if end if elseif s_wait>0 then if datediff("s",wait_time,start_time)>0 then if datediff("s",start_time,end_time)>0 then action_groups(1,igroup)=color(0)'ok else if datediff("s",start_time,timedate)>crash_time then action_groups(1,igroup)=color(2) 'crash else action_groups(1,igroup)=color(1) 'in progress end if end if else if datediff("s",wait_time,timedate)>crash_time then action_groups(1,igroup)=color(6) 'crash else action_groups(1,igroup)=color(5) 'waiting end if end if end if end if end if ' ' DV analysis ' find if has been processed by DV, this is run only if run type is ALLBEAM ' loop through the action_groups array to see if DV present ' igroup=i_dv If igroup>-1 Then s_start=false For i=0 to nactions-1 If actions(2,i)="DV" Then If actions(0,i)="DV_PLOT_SEQ" Then If CInt(action_results(0,i))>0 Then s_start=true End If End If End If Next ' ' make the final decision ' If s_start Then action_groups(1,igroup)=color(0)'green ,ok Else action_groups(1,igroup)=color(4) 'grey, not done End If End if ' ' Print the full row ' response.write("" & vbCrLf) If summary then For igroup=0 to ngroups-1 if action_groups(1,igroup)=color(0) then all=true else all=false end if next If all then if text_only="1" then response.write("" &vbcrlf) else response.write("" &vbcrlf) end if else if text_only="1" then response.write("" &vbcrlf) else response.write("" &vbcrlf) end if end if else For igroup=0 To ngroups-1 If text_only="1" then Response.write("" &vbCrLf) Else Response.write("" & vbCrLf) End if Next end if ' close row for this sequence ' Loop ' ' close table for last run/sequence ' Response.write("
 
Run ") Response.write( run & "
   "& sequence & "" & color(0) &"" & color(0)& "alt="""& sequence &""">"& color(4)&"" & color(4)& "alt="""& sequence &""">" & action_groups(1,igroup) & " " & vbCrLf) Response.write( action_groups(1,igroup) & vbCrLf) Response.write(" alt=""" & action_groups(0,igroup) & """>
" & vbCrLf) %>

 

<%if text_only="1" then response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") else response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") response.write("") End if %>
" & color(0) & "" & color(1) & "" & color(4) & "" & color(2) & "" & color(6) & "" & color(5) & "" & color(3) & "" & color(0) & ">" & color(1) & ">" & color(4) & ">" & color(2) & ">" & color(6) & ">" & color(5) & ">" & color(3) & ">
OK In Progress Not Done CRASH(job started but never finished) CRASH(job submitted but never started) Waiting Unknown
<% ' ' CLose database connection ' Set RS=nothing Connection.Close Set Connection=nothing time_stop=Now() time_tot=Round(24*60*60*(time_stop-time_start),1) Response.write("" & time_tot & "") %>